package com.geek.zookeeper.curator.services;

import com.geek.services.BaseRepository;
import com.geek.zookeeper.curator.entity.ZooProduct;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

@Repository
public interface ZooProductRepository extends BaseRepository<ZooProduct> {

	@Modifying
	@Query("update zoo_product p set p.stock = p.stock-1 where p.id = ?1")
	void updateStock(long id);

}
